<?php

$q = strtolower( $_GET["q"] );
if (!$q) return;

$dbhost = "localhost";		// Database Host
$dbuser = "plotkinm";			// User
$dbpass = "FaceBooK";			// Password
$dbname = "plotkinm_db";			// Name of Database

mysql_connect( $dbhost, $dbuser, $dbpass, $dbname ) or die( mysql_error() );
mysql_select_db( $dbname ) or die( mysql_error() );

// Replace "TABLE_NAME" below with the table you'd like to extract data from
$data = mysql_query( "SELECT * FROM `states` ")
or die( mysql_error() );

// Replace "COLUMN_ONE" below with the column you'd like to search through
// In between the if/then statement, you may present a string of text
// you'd like to appear in the textbox.
while( $row = mysql_fetch_array( $data )){
	if ( strpos( strtolower( $row['name'] ), $q ) !== false ) {
		echo $row['name'] . " - " . $row['abbrev'] . "\n";
	}
}
?>